require_relative '../node_modules/react-native-macos/scripts/react_native_pods'
# require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

prepare_react_native_project!

target 'io.invertase.testing-macOS' do
  platform :macos, '11.0'
  # use_native_modules!

  # Flags change depending on the env values.
  flags = get_default_flags()

  use_react_native!(
    :path => '../node_modules/react-native-macos',
    :hermes_enabled => false,
    :fabric_enabled => ENV['RCT_NEW_ARCH_ENABLED'] == '1',
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-async-storage/async-storage'

  post_install do |installer|
    # Remove this script for React-Fabric macOS 0.74.1
    installer.pods_project.targets.each do |target|
      if target.name == 'React-Fabric'
        target.build_phases.each do |phase|
          if phase.display_name == '[CP-User] [RN]Check rncore'
            target.build_phases.delete(phase)
          end
        end
      end
    end
    react_native_post_install(installer)
  end
end
